/**
 * Advanced Software Engineering (Monica Farrow)
 * DepotMain class
 * 
 * Some of the methods in this class have been based on lecture notes provided by
 * Monica Farrow as a part of Software Engineering courses at Heriot-Watt University.
 */

package depotAdmin;

import java.io.File;

import depotModels.*;
import depotControllers.*;
import depotViews.*;


/**
 * DepotMain class for creating models, views, controllers
 * and starting controller threads
 * @author Ionut Iordache, Nikky Afunugo, Dave Bond
 */
public class DepotMain {


	/**
	 *  main method for depot program
	 * @param args  arguments passed to method
	 */
	public static void main(String[] args) {

		// delete old eventLog
		File file001 = new File("eventLog.txt");		 
		file001.delete();

		// create MODELS

		// create the ParcelUncollected object
		ParcelUncollected pu  = new ParcelUncollected();

		// create the CustomerQueue object
		CustomerQueue cq  = new CustomerQueue();

		// create the CustomerProcessing object
		CustomerProcessing cp  = new CustomerProcessing();

		// create VIEWS

		// create the ParcelGUI object that know about ParcelUncollected
		ParcelGUI pg  = new ParcelGUI(pu);

		// create the CustomerGUI object that know about CustomerQueue
		CustomerGUI cg  = new CustomerGUI(cq);

		// create the ProcessingGUI object that know about CustomerProcessing
		ProcessingGUI prg  = new ProcessingGUI(cp);


		// create CONTROLLERS

		// create the ParcelController object that know about ParcelGUI
		// and ParcelUncollected
		ParcelController pc  = new ParcelController(pg,pu);

		// create the CustomerController object that know about CustomerGUI
		// and CustomerQueue and ParcelUncollected
		CustomerController cc  = new CustomerController(cg,cq,pu);

		// create the ProcessingController object that know about ProcessingGUI
		// and CustomerProcessing and CustomerQueue
		ProcessingController prc  = new ProcessingController(prg,cp,cq);

		// create ADMIN GUI
		AdminGUI ag = new AdminGUI();

		// create THREADS

		// create a ParcelController thread and start it
		Thread parcelThread = new Thread (pc);
		parcelThread.start();

		// create a CustomerController thread and start it
		Thread custThread = new Thread (cc);
		custThread.start();

		// create a ProcessingController thread and start it
		Thread procThread = new Thread (prc);
		procThread.start(); 

		// create an AdminGUI thread and start it
		Thread adminThread = new Thread (ag);
		adminThread.start();
		
	}


}